﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace ProgramMain.Reports
{
    public partial class CallByDirEditorCtl : Framework.BaseDetailCtl
    {
        public CallByDirEditorCtl()
        {
            InitializeComponent();
        }

        private void CallByDirEditorCtl_DetailIDChanged(object sender, EventArgs e)
        {
            callByDirectionListCtl1.DetailID = this.DetailID;
            if (DetailID.HasValue)
            {
                simpleButton1_Click(sender, e);
            }
        }

        private void callByDirectionListCtl1_ViewRowIDChanged(object sender, Framework.BaseDetailCtl.ShowDetailEventArgs e)
        {
            if (e.DetailID.HasValue)
            {
                panelCallByDir.Visible = false;
                panelCallByClient.Dock = DockStyle.Fill;
                panelCallByClient.Visible = true;

                callByClientDirListCtl1.comboYearEdit.EditValue = callByDirectionListCtl1.comboYearEdit.EditValue;
                callByClientDirListCtl1.comboMonthEdit.EditValue = callByDirectionListCtl1.comboMonthEdit.EditValue;

                callByClientDirListCtl1.DetailID = this.DetailID;
                callByClientDirListCtl1.DirectionID = Convert.ToInt32(e.DetailID.Value);
                callByClientDirListCtl1.RefreshControl();
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            panelCallByClient.Visible = false;
            panelCallByDir.Dock = DockStyle.Fill;
            panelCallByDir.Visible = true;
        }
    }
}
